package enum_;

/**
 * Created with IntelliJ IDEA.
 * ClassName: SeasonTset
 * Package: enum_
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-11-27
 * Time: 11:14
 */

public class SeasonTest {

    public static void main(String[] args) {

        System.out.println(Season.spring);

        System.out.println(Season.summer.getSeasonDesc());


    }

}

//jkd5.0 之前定义枚举类的方式
//定义季节的枚举类
class Season {

    //声明当前类的实例变量
    private final String seasonName; //季节的名称
    private final String seasonDesc; //季节的概述

    //1.私有化构造器  枚举是单例的
    private Season(String seasonName, String seasonDesc) {
        this.seasonName = seasonName;
        this.seasonDesc = seasonDesc;
    }

    //创建当前类的实例
    public static final Season spring = new Season("春天", "春暖花开");
    public static final Season summer = new Season("夏天", "夏日炎炎");
    public static final Season autumn = new Season("秋天", "秋高气爽");
    public static final Season winter = new Season("冬天", "白雪皑皑");

    //提供实例变量get方法
    public String getSeasonName() {
        return seasonName;
    }

    public String getSeasonDesc() {
        return seasonDesc;
    }
}
